<?php
use app\models\Mall;
use app\widgets\MallMBottomToolbarWidget;
use yii\helpers\Url;

$web = Url::base();
$institution_code=Mall::getCurrentInstitutionCode();
$site_name = \app\models\Mall::getCurrentInstitutionSiteName();
$this->title = $site_name . '-我的订单';
?>

<link rel="stylesheet" type="text/css" href="<?= $web ?>/css/mall-m/order-list.css"/>
<link rel="stylesheet" type="text/css" href="<?= $web ?>/css/mall-m/cross-title.css"/>
<style type="text/css">
    .order-list {
        padding-bottom: 2.5em
    }
</style>
<div class="main">
    <div class="order-list">
        <?php
        if (count($items) > 0) {
            for ($i = 0; $i < count($items); $i++) {
                ?>
                <div class="indents">
                    <div class="state">
                        <p class="time f-l"><?= $items[$i]['create_datetime'] ?></p>
                        <p class="deal f-r"><?= $items[$i]['status_name'] ?></p>
                    </div>
                    <div class="order">
                        <?php
                        $goodsitems = $items[$i]['goods_list'];
                        if ($goodsitems != null) {
                            for ($j = 0; $j < count($goodsitems); $j++) {
                                ?>
                                <div class="order-detail">
                                    <div class="content">
                                        <a href="goods-detail?goods_code=<?= $goodsitems[$j]['goods_code'] ?>">
                                            <img class="f-l" src="<?= $goodsitems[$j]['image_url'] ?>@120w"/>
                                        </a>
                                        <p class="title f-l crossborder">
                                            <?php
                                            if($goodsitems[$j]['is_crossborder']=='1'){
                                                ?>
                                                <span>跨境</span>
                                                <?php
                                            }
                                            ?>
                                            <?= $goodsitems[$j]['goods_name'] ?></p>
                                        <p class="integral f-r">
                                            积分：<span><?= number_format($goodsitems[$j]['selling_integral']) ?></span>
                                        </p>
                                        <p class="classify f-r"><span>&nbsp;</span></p>
                                        <p class="size f-l">数量：<span><?= $goodsitems[$j]['quantity'] ?></span></p>
                                    </div>
                                </div>
                                <?php
                            }
                        }
                        ?>
                        <div class="detail-btn-frame">
                            <a href="order-detail?orderCode=<?= $items[$i]['code'] ?>&institution_code=<?=$institution_code?>" class="detail-btn">订单详情 </a>
                        </div>
                        <div class="total">
                            <p class="integral f-r">积分：<span><?= number_format($items[$i]['integral']) ?></span></p>
                            <p class="number f-r">共 <span><?= $items[$i]['total_quantity'] ?></span> 件商品</p>
                        </div>
                    </div>
                </div>

                <?php
                if ($i < count($items) - 1) {
                    ?>
                    <div class="boundary"></div>
                    <?php
                }
            }
        } else {
            ?>
            <div class="page-prompt-2">
                <img class="page-prompt" src="<?= $web ?>/images/mall-m/page-prompt-2.png"/>
                <p class="title">对不起目前没有数据</p>
                <a href="javascript:history.back();">
                    <div class="go-homepage">
                        <img src="<?= $web ?>/images/mall-m/go-back.png"/>
                        <p>返回</p>
                    </div>
                </a>
            </div>
            <?php
        }
        ?>
    </div>
    <?=MallMBottomToolbarWidget::widget(['actionName'=>''])?>
</div>
